#![allow(non_camel_case_types, non_snake_case)]
use crate::co;
use crate::decl::*;
use crate::kernel::ffi_types::*;
use crate::ole::privs::*;
use crate::prelude::*;
use crate::vt::*;
#[repr(C)]
pub struct IDXGIResourceVT {
pub IDXGIDeviceSubObjectVT: IDXGIDeviceSubObjectVT,
pub GetSharedHandle: fn(COMPTR, *mut HANDLE) -> HRES,
pub GetUsage: fn(COMPTR, *mut u32) -> HRES,
pub SetEvictionPriority: fn(COMPTR, u32) -> HRES,
pub GetEvictionPriority: fn(COMPTR, *mut u32) -> HRES,
}
com_interface! { IDXGIResource: "035f3ab4-482e-4e50-b41f-8a7f8bd8960b";
}
impl dxgi_IDXGIObject for IDXGIResource {}
impl dxgi_IDXGIDeviceSubObject for IDXGIResource {}
impl dxgi_IDXGIResource for IDXGIResource {}
pub trait dxgi_IDXGIResource: dxgi_IDXGIDeviceSubObject {
#[must_use]
fn GetEvictionPriority(&self) -> HrResult<co::DXGI_RESOURCE_PRIORITY> {
let mut eviction_priority = co::DXGI_RESOURCE_PRIORITY::default();
ok_to_hrresult(
unsafe {
(vt::<IDXGIResourceVT>(self).GetEvictionPriority)(
self.ptr(),
eviction_priority.as_mut()
)
},
).map(|_| eviction_priority)
}
#[must_use]
fn GetSharedHandle(&self) -> HrResult<*mut std::ffi::c_void> {
let mut handle: *mut std::ffi::c_void = std::ptr::null_mut();
ok_to_hrresult(
unsafe {
(vt::<IDXGIResourceVT>(self).GetSharedHandle)(
self.ptr(),
&mut handle,
)
},
).map(|_| handle)
}
#[must_use]
fn GetUsage(&self) -> HrResult<co::DXGI_USAGE> {
let mut usage = co::DXGI_USAGE::default();
ok_to_hrresult(
unsafe {
(vt::<IDXGIResourceVT>(self).GetUsage)(
self.ptr(),
usage.as_mut(),
)
},
).map(|_| usage)
}
fn SetEvictionPriority(&self,
eviction_priority: co::DXGI_RESOURCE_PRIORITY,
) -> HrResult<()>
{
ok_to_hrresult(
unsafe {
(vt::<IDXGIResourceVT>(self).SetEvictionPriority)(
self.ptr(),
eviction_priority.raw(),
)
},
)
}
}